โก LLM Inference Optimization โ Notes โ
๐บ Source
Notes from the YouTube course Inference Optimization: From First Principles to Production by Mani Khanuja (The Agentic Enterprise). 29 episodes, covering Modules 0 โ 7.
Training is buying the car. Inference is the taxi meter โ it starts with your first user and never stops.
๐งญ The whole course on one page โ
๐๏ธ The two rules that hold everything together โ
1. You can optimize only two of three โ
They're one budget, not three separate goals. Push latency down and you serve fewer users per GPU, so cost goes up. Pack more users in and everyone waits longer.
2. Every technique pulls one of four levers โ
| Lever | Examples in this course |
|---|---|
| ๐ฆ Move fewer bytes | Quantization, GQA/MLA, KV-cache compression, FlashAttention |
| ๐งฎ Do fewer calculations | Sparse attention, sliding windows, prefix caching |
| ๐ค Share work across requests | Batching, continuous batching, prefix caching, copy-on-write |
| ๐ Overlap work | Chunked prefill, FlashAttention 3 ping-pong, API/engine process split |
๐ธ Why it matters โ DeepSeek's real meter (Feb 2025)
One day of production cost $87,072. At their list R1 pricing the same tokens would have been worth more than 6ร that (DeepSeek themselves call this figure theoretical). Engineering closes most of that gap. Pricing doesn't.
๐ Chapters โ
| # | Chapter | Episodes |
|---|---|---|
| 0 | ๐ Orientation & the request map | 00 โ 01 |
| 1 | ๐ฃ๏ธ Request lifecycle, metrics & benchmarking | 02 โ 07 |
| 2 | ๐งฑ The two walls: compute vs memory | 08 โ 13, 17 |
| 3 | ๐ญ Observability: what to measure | 14 โ 16 |
| 4 | ๐งบ Batching & scheduling | 18 โ 21 |
| 5 | ๐ง Attention: the architecture side | 22 โ 24 |
| 6 | โ๏ธ Attention: the kernel side | 25 โ 27 |
| 7 | ๐ข Quantization & numerics | 28 |
๐ฉบ The master diagnosis tree โ
Start from the symptom, then find the cause:
๐ง The one number the course leans on
Arithmetic intensity (FLOPs per byte moved) vs the GPU's ridge point. If you remember one idea, remember this one โ Chapter 2.
